package com.xinyi.shicihui.scrapy;

import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;

import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.util.Base64;
import java.util.Collections;

/**
 * @author xinyi
 * @desc 最简单的Http爬虫程序
 * @date 2022/1/23
 */
@Component
public class HttpScrapyComponent {
    public static final String BASE_URL = "https://api.xungushici.com";

    @Autowired
    private RestTemplate restTemplate;

    public void scrapy(String url) {
        /**
         * RestTemplate设置使用请求头的拦截器
         */
        Object templateForObject = restTemplate.getForObject(url, Object.class);
        System.out.println(templateForObject);
    }
}
